<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            border:1px solid #000
        }
        #menuDiv{
            width: 200px;
        }
        .head{
            background-color: #6ee7b7;
            text-align: center;
            height: 30px;
        }
        .body{
            background-color: yellow;
            text-align: center;
            height: 100px;
            display: none;
        }
    </style>

    <script>
        var showDivObj;
        window.onload = function (){
            showDivObj = document.getElementById("black");
        }

        function showBody(divId){
            //正在显示的div做隐藏
            showDivObj.style.display = "none";
            //得到要显示div对象
            var divObj = document.getElementById(divId);
            //让该div进行显示
            divObj.style.display = "block";
            showDivObj = divObj;
        }
    </script>
</head>
<body>
<div id="menuDiv">
    <div class="head" onclick="showBody('friend')">好友</div>
    <div class="body" id="friend">
        韦小宝<br>
        陈近南<br>
        风际中
    </div>
    <div class="head" onclick="showBody('parent')">亲人</div>
    <div class="body" id="parent">
        向问天<br>
        令狐冲<br>
        胡一刀
    </div>
    <div class="head" onclick="showBody('black')">黑名单</div>
    <div class="body" id="black" style="display: block">
        岳不群<br>
        海大富<br>
        东方不败
    </div>
</div>
</body>
</html>